(function($) {
	$.fn.markScrollTop = function(options) {
		var settings = $.extend({
			range: 500,
			speed: 600
		}, options);

		return this.each( function() {
			var element = $(this);
			var win = $(window);
			
			element.fadeOut();
			win.scroll(function() {
				if (win.scrollTop() > settings.range) {
					element.fadeIn();
				} else {
					element.fadeOut();
				}
			});
			element.click(function() {
				$('html, body').animate({
					scrollTop: 0
				}, settings.speed);
			});
			if ($.isFunction(settings.complete)) {
				settings.complete.call(this);
			}
		});
	};
	
	$.fn.markSmoothScroll = function(options) {
		var settings = $.extend({
			speed: 600
		}, options);

		return this.each( function() {
			$(this).click(function() {
				if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
					var $target = $(this.hash);
					$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
					if ($target.length) {
						var targetOffset = $target.offset().top;
						$('html,body').animate({scrollTop: targetOffset}, settings.speed);
					}
				}
			});
		});
	};
}(jQuery));
